<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: id
  Date: 2021/3/6
  Time: 15:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page  isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<link rel="stylesheet" href="../../../static/login.css">
<html>
<head>
    <title>Login</title>
    <script type="text/javascript" src="../../../static/jquery-3.4.1.js"></script>
    <script type="text/javascript">
        $(function () {
            /*效验*/
            var fl=true;
            var re =/[\u4e00-\u9fa5]/;  //中文
            var reg = /^[0-9]+.?[0-9]*$/;           //数字
            var reg2 = /^[A-Za-z]+$/ //字母
            var reg3 = /^(?!\d+$)(?![a-zA-Z]+$)[a-zA-Z\d]+$/ //数字英文结合

            var username=$("#un").val();
            var password=$("#pw").val();
            if(username==null || username==""||password==null || password==""){
                fl=false
            }else {
                $("#s1").html("√")
                $("#s2").html("√")
                fl=true
            }

            var path=$("#path").val();
            $("#un").blur(function () {
                if($("#un").val()==null||$("#un").val()==""){
                    $("#s1").html("username不能为空")
                    fl=false
                }else if(re.test($("#un").val())){
                    $("#s1").html("username不能为中文!")
                    fl=false
                } else {
                    //ajax
                    var user_name = $("#un").val();
                    $.getJSON(path+"/reg2", {name:user_name}, function (data) {
                        if (data.userCode == "exist") {
                            $("#s1").html("×");
                            $("#s11").html("已经存在!");
                            fl=false;
                        } else if (data.userCode == "no") {
                            $("#s1").html("√");
                            $("#s11").html("可以注册!");
                            fl=true;
                        }
                    })
                }
            })

            $("#pw").blur(function () {
                if($("#pw")==null||$("#pw").val()==""){
                    $("#s2").html("password不能为空")
                    fl=false
                }else if(!reg3.test($("#pw").val())){
                    $("#s2").html("password必须包含数字和字母")
                    fl=false
                }
                else {
                    $("#s2").html("√")
                }
            })


            /*表单验证*/
            $("Form").submit(function () {
                return fl;
            })




        })
    </script>
</head>
<body>
<input type="hidden" id="path" value="${pageContext.request.contextPath}">
<div id="d1">
    <div id="d2">
        <div id="d2_01">
            <div>
                <h1 style="margin-top: 28px;margin-left: 35px;margin-bottom: 9px;color: white">博宏</h1>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: white;font-size: 1.3em;">进销存软件平台</span>
                <br><br><br>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: pink">移动开发1902 项目组二组</span>
                <br><br>
                <div id="sp">
                    <span style="color:white;">
                        进销存，又称为购销链，是指企业管理过程中采购(进)->入库(存)->销售(销)的动态管理过程。进:指询价、采购到入库与付款的过程。
销:指报价、销售到出库与收款的过程。存:指出入库之外，包括领料、退货、盘点、损益、借入、借出、调拨等影响库存数量的动作。
                    </span>
                </div>
                <br>
                <hr style="width: 300px;margin-left: 25px;color: palevioletred">
                <br>
                <span style="margin-left: 41px;color: pink">生命的有些时候，你必须去挑战伟大</span>


            </div>

        </div>
        <div id="d2_02">
            <div id="a" style="margin-bottom: -18px">
                <span id="d0" style="color: rgb(64,72,91)">注册</span>
                <div id="b">
                    <a href="${pageContext.request.contextPath}/Log" class="f">已有账号? 点此登录</a>
                </div>
            </div>
            <div id="C">



                <form method="post" action="${pageContext.request.contextPath}/regUser2">
                    <input type="text" class="i"  name="username" placeholder="请输入用户名" style="height: 2.3em;" id="un">
                    <span id="s1"style="color: red"></span>
                    <span id="s11"style="color: red"></span>
                    <br><br>
                    <input type="password" class="o" name="password" placeholder="请输入密码" style="height: 2.3em;" id="pw"><span id="s2"style="color: red"></span><br><br>
                    <span style="color: deeppink;margin-bottom: 8px;display: inline-block">职务</span><br>
                    <select class="o" style="height: 2.3em;padding-left: 124px" name="sid">
                        <c:forEach items="${userStyleList}" var="userStyleList">
                            <option value="${userStyleList.sid}">${userStyleList.uname}</option>
                        </c:forEach>
                    </select><br>
                    <select class="o" style="height: 2.3em;padding-left: 124px" name="storesid">
                        <c:forEach items="${stList}" var="stList">
                            <option value="${stList.id}">${stList.sname}</option>
                        </c:forEach>
                    </select>
                    <input type="submit" value="注册" class="s" style="background: darkorange;width:300px; height:35px; border: none; font-size:1.1em;margin-top: 10px"><br><br>
                    <br><div style="margin-top: -14px">
                    <a href="#" style="float: left" class="l">忘记密码</a>
                    <a href="#" style="float: right" class="p">短信验证</a>
                </div>
                </form>
            </div>
        </div>
    </div>


</div>

</body>
</html>

